/****** Object:  StoredProcedure [dbo].[spGetPhieuGiaoHangListByDate]    Script Date: 09/30/2012 00:21:59 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spGetPhieuGiaoHangListByDate]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[spGetPhieuGiaoHangListByDate]
GO

/****** Object:  StoredProcedure [dbo].[spGetPhieuGiaoHangListByDate]    Script Date: 09/30/2012 00:21:59 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE procedure [dbo].[spGetPhieuGiaoHangListByDate]
		@tungay datetime,
		@denngay datetime	
WITH ENCRYPTION
AS
	Begin
		Select *
		From tbl_PhieuGiaoHang pgh
		Where (@tungay is null) or (convert(date, @tungay) <= convert(date, pgh.NgayGiao))
		  AND ((@denngay is null) or (convert(date, @denngay) >= convert(date, pgh.NgayGiao)))
		Order by pgh.NgayGiao asc
	End
GO


